package com.hjy.auth.web;

import com.hjy.auth.feign.TestFeignService;
import com.hjy.common.utils.R;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@ResponseBody
public class TestController {
    @Autowired
    private TestFeignService testFeignService;

    @RequestMapping("/1")
    public R test1(HttpServletRequest request){
        testFeignService.test1();
        return R.ok();
    }

    @RequestMapping("/2")
    public R test2(User user, HttpServletRequest request){
        testFeignService.test2(user);
        return R.ok();
    }

    @RequestMapping("/3")
    public R test3(User user, HttpServletRequest request){
        testFeignService.test3(user);
        return R.ok();
    }

    @RequestMapping("/4")
    public R test4(@RequestBody User user,HttpServletRequest request){
        testFeignService.test4(user);
        return R.ok();
    }

    @RequestMapping("/5")
    public R test5(@RequestBody User user, HttpServletRequest request){
        testFeignService.test5(user);
        return R.ok();
    }

    @RequestMapping("/6")
    public R test6(@RequestBody User user, String hello, HttpServletRequest request){
        testFeignService.test6(user,hello);
        return R.ok();
    }

    @RequestMapping("/7")
    public R test7(@RequestBody User user, String hello, HttpServletRequest request){
        testFeignService.test7(user,hello);
        return R.ok();
    }

    @RequestMapping("/8")
    public R test8(String hello1,String hello2){
        testFeignService.test8(hello1,hello2);
        return R.ok();
    }

    @RequestMapping("/9")
    public R test9(String hello1, String hello2){
        testFeignService.test9(hello1,hello2);
        return R.ok();
    }

    @RequestMapping("/10")
    public R test9(){
        testFeignService.test10("10");
        return R.ok();
    }

    @Data
    public static class User {
        private String username;
        private String password;
    }
}
